Sensible SQL Warehouse Defaults for Governance and Cost Control

sql
governance
cost
Configure workspace-level SQL Warehouse settings in Databricks with sensible defaults to improve governance, prevent runaway queries, and control costs.
Modified

03/03/2026

Summary

  • Configure workspace-level SQL configuration parameters for all SQL Warehouses
  • Set sensible defaults for STATEMENT_TIMEOUT, ANSI_MODE, TIMEZONE, and more
  • Prevent runaway queries, enforce SQL standards, and improve cost governance

Introduction

Every Databricks workspace ships with SQL Warehouse configuration parameters set to very permissive defaults. A query can run for 2 full days before it times out. ANSI mode may be off for older accounts, hiding silent behaviour. These are the kind of settings that, left untouched, lead to bill shock and hard-to-diagnose data quality issues.

The good news is that workspace admins can override these defaults in a single place and have them apply to every SQL Warehouse in the workspace. This post walks through the key parameters and recommends sensible starting points.

NoteAdmin Access Required

You must be a workspace admin to view and change these settings. If you’re not an admin, share this post with your team and advocate for setting these defaults.

They can only be set at the workspace level, not for all workspaces in an databricks account, so each workspace needs to be configured individually.

Where to Set These Parameters

Navigate to Admin Settings > Compute > SQL Warehouses > SQL Configuration Parameters.

Enter one key-value pair per line, separating the parameter name from its value with a space:

STATEMENT_TIMEOUT 3600
ANSI_MODE true
TIMEZONE UTC
WarningRestart Warning

Changing any SQL configuration parameter will automatically restart all running SQL Warehouses in the workspace. Plan changes during a maintenance window or low-usage period.

You can also set these via the SQL Warehouses API for infrastructure-as-code workflows.

Putting It All Together

Here is a recommended workspace-level configuration block you can paste directly into the SQL Configuration Parameters textbox:

STATEMENT_TIMEOUT 3600
ANSI_MODE true
TIMEZONE UTC
USE_CACHED_RESULT true
LEGACY_TIME_PARSER_POLICY EXCEPTION

Managing as Infrastructure as Code

Clicking through the Admin UI is fine for a single workspace, but if you manage multiple environments (dev, staging, prod) you want these settings version-controlled and reproducible.

Terraform

The databricks_sql_global_config resource lets you set all the recommended parameters in one block using sql_config_params:

resource "databricks_sql_global_config" "this" {
  sql_config_params = {
    "STATEMENT_TIMEOUT"         = "3600"
    "ANSI_MODE"                 = "true"
    "TIMEZONE"                  = "UTC"
    "USE_CACHED_RESULT"         = "true"
    "LEGACY_TIME_PARSER_POLICY" = "EXCEPTION"
  }
}
WarningRestart Warning

Just like the UI, any change to this Terraform resource will automatically restart all running SQL Warehouses in the workspace. Run terraform plan carefully and apply during low-usage periods.

Databricks Asset Bundles (DABs)

DABs can manage individual sql_warehouse resources (size, auto-stop, serverless, etc.) but does not currently support a sql_global_config resource type for workspace-level SQL configuration parameters.

So use Terraform or the SQL Warehouses API to manage these global defaults alongside your DABs deployments.

Quick Reference Table

Parameter System Default Recommended Why
STATEMENT_TIMEOUT 172,800s (2 days) 3,600s (1 hour) Prevent runaway query costs
ANSI_MODE TRUE / FALSE* TRUE Enforce SQL standards, catch bugs early
TIMEZONE UTC UTC Consistency across pipelines
USE_CACHED_RESULT TRUE TRUE Free cost savings on repeated queries
LEGACY_TIME_PARSER_POLICY EXCEPTION EXCEPTION Strictest date parsing, no silent errors

*FALSE for accounts created before October 2022

References & Further Reading

Back to top